package com.etime.shycourse.controller.accountonline;

import com.etime.shy.common.BaseMessage;
import com.etime.shycourse.orde.pojo.Orders;
import com.etime.shycourse.orde.services.interfaces.WxOrdersServices;
import com.etime.shycourse.services.account.interfaces.OnlineCourseAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "用于测试订单结算的数据接口--测试使用")
@RestController
@RequestMapping("/sys/account/test")
public class AccountTestController {
    @Autowired
    private WxOrdersServices wxOrdersServices;
    @Autowired
    private OnlineCourseAccountService onlineCourseAccountService;

    @ApiOperation("处理订单结算--测试用")
    @ApiImplicitParam("订单id")
    @RequestMapping("/dealorder/{orderid}")
    public BaseMessage accountOrder(@PathVariable("orderid") Integer orderid){
        Orders orders = wxOrdersServices.selectOrdersById(orderid);
        onlineCourseAccountService.onlineCourseAccount(orders);
        BaseMessage msg = new BaseMessage();
        msg.setCode(1);
        msg.setMsg("处理订单完成");
        return msg;
    }
}
